﻿<UserControl x:Class="Kiosk.UserControls.ucImageButton"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="300" Width="300" >
    <UserControl.Resources>
        <Style x:Key="ucImageButtonStyle" TargetType="Image">
            <!--<Setter Property="Margin" Value="10,5,0,10" />-->
            <Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
            <Setter Property="Stretch" Value="Uniform" />
            <Setter Property="Cursor" Value="Hand" />
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Trigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard >
                                <DoubleAnimation AutoReverse="True" RepeatBehavior="Forever" To=".3" Duration="0:0:0.5" 
                                            Storyboard.TargetProperty="(Image.Opacity)" />
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                    <Trigger.ExitActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation Duration="0:0:0.2"  To="1"
                                        Storyboard.TargetProperty="(Image.Opacity)" />
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.ExitActions>
                </Trigger>
            </Style.Triggers>
        </Style>

    </UserControl.Resources>
    <Grid RenderTransformOrigin=".5,.5">
        <Grid.RenderTransform>
            <ScaleTransform x:Name="grdScale" ScaleX="1" ScaleY="1" />
        </Grid.RenderTransform>
        <Grid.Triggers>
            <EventTrigger RoutedEvent="Grid.MouseLeftButtonUp" >
                <BeginStoryboard>
                    <Storyboard>
                        <DoubleAnimation From="1" To="1.15" AutoReverse="True" Storyboard.TargetName="grdScale" Storyboard.TargetProperty="ScaleX"  Duration="0:0:0.1" ></DoubleAnimation>
                        <DoubleAnimation From="1" To="1.15" AutoReverse="True" Storyboard.TargetName="grdScale" Storyboard.TargetProperty="ScaleY"  Duration="0:0:0.1" ></DoubleAnimation>
                        <DoubleAnimation BeginTime="0:0:0.2" From="1" To=".85" Storyboard.TargetName="grdScale" Storyboard.TargetProperty="ScaleX" AutoReverse="True" Duration="0:0:0.1" ></DoubleAnimation>
                        <DoubleAnimation BeginTime="0:0:0.2" From="1" To=".85" Storyboard.TargetName="grdScale" Storyboard.TargetProperty="ScaleY" AutoReverse="True" Duration="0:0:0.1" ></DoubleAnimation>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Grid.Triggers>

        <Image Name="imgGlow" Grid.Column="0" Grid.Row="0" Source="images\placeholder.png" ></Image>
        <Image Name="imgMain" Grid.Column="0" Grid.Row="0" Source="images\placeholder.png" Style="{StaticResource ucImageButtonStyle}" >
        </Image>
    </Grid>
</UserControl>
